#include <rtpudpv4transmitter.h>
#include <rtpsessionparams.h>
#include "RTPReciever.h"
#include "PlayIPSound.h"
int main()
{
	WSADATA dat;
	WSAStartup(MAKEWORD(2,2),&dat);

	MutexBuffer buf( 32000 );
	HANDLE playEvent = CreateEvent( 0, true, false, 0);

	ipsound::RTPReciever reciever( &buf, playEvent );
	ipsound::PlayIPSound sound( &buf, GetConsoleWindow());

	RTPUDPv4TransmissionParams transparams;
	RTPSessionParams sessparams;

	sessparams.SetOwnTimestampUnit( 1.0 / 8000.0 );
	transparams.SetPortbase( 3000 );
	int status = reciever.Create(sessparams,&transparams);

	WaitForSingleObject( playEvent, INFINITE );

	sound.Start();

	CloseHandle( playEvent );

	while (true)
	{
		RTPTime::Wait(10000);
	}
	
	WSACleanup();
	return 0;
}